#include <stdio.h>

void hanoi (int a, int b, int c, int k);
//k个盘子从a借助b到c

int main (void)
{
    int deep = 0;
    printf("输入汉诺塔的层数:\n");
    scanf("%d",&deep);
    hanoi(0,1,2,deep);
    return 0;
}

void hanoi (int a, int b, int c, int k)
{
    if(k == 1)
    {
        printf("%c -> %c\n",a+'a',c+'a');
        return ;
    }
    hanoi(a,c,b,k-1);
    printf("%c -> %c\n",a+'a',c+'a');
    hanoi(b,a,c,k-1);
}